package cn.iocoder.yudao.module.fengdong.smartelderly.dal.mysql.accessrecord;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.fengdong.smartelderly.dal.dataobject.accessrecord.AccessRecordDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.fengdong.smartelderly.controller.admin.accessrecord.vo.*;

/**
 * 门禁记录 Mapper
 *
 * @author 沣东养老院管理员
 */
@Mapper
public interface AccessRecordMapper extends BaseMapperX<AccessRecordDO> {

    default PageResult<AccessRecordDO> selectPage(AccessRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AccessRecordDO>()
                .eqIfPresent(AccessRecordDO::getActivityKind, reqVO.getActivityKind())
                .eqIfPresent(AccessRecordDO::getUserId, reqVO.getUserId())
                .eqIfPresent(AccessRecordDO::getContent, reqVO.getContent())
                .betweenIfPresent(AccessRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AccessRecordDO::getId));
    }

    default List<AccessRecordDO> selectList(AccessRecordExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<AccessRecordDO>()
                .eqIfPresent(AccessRecordDO::getActivityKind, reqVO.getActivityKind())
                .eqIfPresent(AccessRecordDO::getUserId, reqVO.getUserId())
                .eqIfPresent(AccessRecordDO::getContent, reqVO.getContent())
                .betweenIfPresent(AccessRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(AccessRecordDO::getId));
    }

}
